import request from "@/request/request";
import qs from "qs"


export function getFoodList(data){
    let url = "/admin/food";
    let param = {
        url:url,
        method:"GET",
        params:data
    }
    return request(param);
}



export function saveFood(id,food){
    let method = "post";
    let url = "/admin/food";
    if(id){
        method = "put";
        url = "/admin/food/"+id;
    }

    let param = {
        url:url,
        method:method,
        data:qs.stringify(food)
    }
    return request(param);
}


export function deleteFoodById(id){
    let param = {
        url:"/admin/food/"+id,
        method:"delete"
    }
    return request(param);
}

export function findById(id){
    let param = {
        url:"/admin/food/"+id,
        method:"get"
    }
    return request(param);
}


export function updateStatus(id,status){
    let param = {
        url:"/admin/food/"+id+"/status",
        method:"put",
        data:"status="+status
    }
    return request(param);
}






